<!DOCTYPE html>
<html lang="en">
<head>
  <title>后台菜单列表-Sydney Admin</title>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link rel="stylesheet" href="../Public/css/bootstrap.min.css" />
  <link rel="stylesheet" href="../Public/css/bootstrap-responsive.min.css" />
  <link rel="stylesheet" href="../Public/css/uniform.css" />
  <link rel="stylesheet" href="../Public/css/select2.css" />
  <link rel="stylesheet" href="../Public/css/matrix-style.css" />
  <link rel="stylesheet" href="../Public/css/matrix-media.css" />
  <link href="../Public/font-awesome/css/font-awesome.css" rel="stylesheet" />
  <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,800' rel='stylesheet' type='text/css'></head>
<body>

  <!-- header -->
  <include file="Sign:header" />
  <!-- header end -->
  <!-- sidebar -->
  <include file="Sign:sidebar" />
  <!-- sidebar end -->
  <div id="content">
    <div id="content-header">
      <div id="breadcrumb">
        <a href="{:U('Index/index')}" title="Go to Home" class="tip-bottom"> <i class="icon-home"></i>
          首页
        </a>
        <a href="__SELF__" class="current">后台菜单列表</a>
      </div>
    </div>
    <div class="container-fluid">
      <div class="row-fluid">
        <div class="span12">
          <div class='alert' style='display:none;'>
            <a class='close' data-dismiss='alert' href='javascript:;'>×</a>
            <span id='actMsg'></span>
          </div>
          <div>
            <form method='get'>
              <input type="text" name='word' value='{$get_word}' style='margin-bottom:0px;' placeholder='根据菜单名称搜索...' />
              <button class='btn'>搜索</button>
              <a href='{:U("Menu/index")}' class='btn'>所有</a>
              <span style="float:right;">
                <button class='btn' type='button' onclick='$("#title-checkbox").click();'>全选</button>
                <button class='btn' type='button'>删除</button>
                <a href='__URL__/data' class='btn'>添加</a>
              </span>
            </form>
          </div>
          <div class="widget-box">
            <div class="widget-title">
              <span class="icon"> <i class='icon-th'></i>
              </span>
              <h5>后台菜单列表</h5>
            </div>
            <div class="widget-content nopadding">
              <table class="table table-bordered table-striped with-check">
                <thead>
                  <tr>
                    <th>
                      <input type="checkbox" id="title-checkbox" name="title-checkbox" />
                    </th>
                    <th>菜单名称</th>
                    <th>分组/模块/操作</th>
                    <th>附加参数</th>
                    <th>是否显示</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                  <volist name="list" id="vo">
                    <tr>
                      <td>
                        <input type="checkbox" />
                      </td>
                      <td>{$vo.name}</td>
                      <td>{$vo.group}/{$vo.module}/{$vo.action}</td>
                      <td>{$vo.param}</td>
                      <td style='text-align:center;'>
                        {:$vo['is_show'] ?'显示':'
                        <span class="state-red">不显示</span>
                        '}
                      </td>
                      <td style='text-align:center;'>
                        <a href='{:U("Menu/data",array("id"=>
                          $vo["id"]))}' class='tip' title='修改' class='act-update'>
                          <i class='icon-pencil'></i>
                        </a>
                        |
                        <a href='{:U("Menu/del_data",array("id"=>
                          $vo["id"]))}' class='tip act-del' title='删除' onclick="return confirm('您确定要删除菜单[{$vo.name}],操作不可恢复?');">
                          <i class='icon-remove'></i>
                        </a>
                      </td>
                    </tr>
                  </volist>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- footer -->
  <include file='Sign:footer' />
  <!-- footer end -->
  <script src="../Public/js/jquery.min.js"></script>
  <script src="../Public/js/jquery.ui.custom.js"></script>
  <script src="../Public/js/bootstrap.min.js"></script>
  <script src="../Public/js/jquery.uniform.js"></script>
  <script src="../Public/js/jquery.dataTables.min.js"></script>
  <script src="../Public/js/matrix.js"></script>
  <script>

  $(document).ready(function(){

    $("#sidebar li").removeClass('active');
    $("#sidebar li:has('a[href='{:U('Menu/index')}']')").addClass('active');
    
    $('.data-table').dataTable({
      "bJQueryUI": true,
      "sPaginationType": "full_numbers",
      "sDom": '<""l>t<"F"fp>'
    });
    
    $('input[type=checkbox],input[type=radio],input[type=file]').uniform();
    
    //$('select').select2();
    
    $("span.icon input:checkbox, th input:checkbox").click(function() {
      var checkedStatus = this.checked;
      var checkbox = $(this).parents('.widget-box').find('tr td:first-child input:checkbox');   
      checkbox.each(function() {
        this.checked = checkedStatus;
        if (checkedStatus == this.checked) {
          $(this).closest('.checker > span').removeClass('checked');
        }
        if (this.checked) {
          $(this).closest('.checker > span').addClass('checked');
        }
      });
    }); 

    $("a.act-del").click(function(e){
      $('#actMsg').html('数据删除中,请稍后...');
      $(".act-del").attr('disabled','disabled');
      $('.alert').addClass('alert-info').show();
      $.get($(this).attr('href'),function(json){
        $('#actMsg').html(json.actMsg);
        $('html,body').animate({scrollTop:0},200);
        $('.alert').removeClass('alert-info').addClass(json.state==1 ? 'alert-success' : 'alert-error').show().delay(2000).fadeOut(function(){
            if(json.state==1)
              window.location.href = "{:U('Menu/index')}";
        });
        
      },'json');
      return false;
    });
  });

  </script>
</body>
</html>